<script setup lang="ts">
import { onMounted, useTemplateRef } from 'vue';
import gsap from 'gsap';

const box = useTemplateRef<HTMLElement>('box');

onMounted(() => {
    const timeline = gsap.timeline();
    timeline
        .to(box.value, { x: 100, duration: 1 })
        .to(box.value, { y: -100, rotation: 180, duration: 1, scale: 0.5 })
        .to(box.value, { y: 0, duration: 1, scale: 1 });
});
</script>

<template>
    <div ref="box" class="box">Timeline</div>
</template>

<style scoped lang="scss">
.box {
    width: 100px;
    height: 100px;
    background-color: coral;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}
</style>
